import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import Layout from '@/views/layout/layout.vue'
const routes: Array<RouteRecordRaw> =
  [
    // {
    //   path: '/',
    //   redirect: '/login',
    // },
    {
      path: '/login',
      component: () => import('@/views/user/login.vue'),
      name: 'login',
      meta: {
        title: '登录',
      }
    },
    {
      path: '/404',
      component: () => import('@/views/user/404.vue'),
      name: '404',
      meta: {
        title: '404',
      }
    },
    {
      path: "/account",
      component: Layout,
      meta: {
        title: "账号管理",
      },
      children: [
        {
          path: "/account/accountList",
          component: () => import('@/views/account/accountList.vue'),
          name: "accountList",
          meta: {
            title: "账号管理"
          },
        },
        {
          path: "/account/accountDetail",
          component: () => import('@/views/account/accountDetail.vue'),
          name: "accountDetail",
          meta: {
            title: "账号详情",
            parentName: 'accountList',
            parentTitle: '账号管理'
          }
        },
        {
          path: "/account/password",
          component: () => import('@/views/account/password.vue'),
          name: "password",
          meta: {
            title: "修改密码"
          }
        },
      ],
    },
    {
      path: "/family",
      component: Layout,
      meta: {
        title: "常驻家庭管理",
      },
      children: [
        {
          path: "/family/familyList",
          component: () => import('@/views/family/familyList.vue'),
          name: "familyList",
          meta: {
            title: "常驻家庭管理"
          },
        },
        {
          path: "/family/familyDetail",
          component: () => import('@/views/family/familyDetail.vue'),
          name: "familyDetail",
          meta: {
            title: "详情",
            parentName: 'familyList',
            parentTitle: '常驻家庭管理'
          },
        },
        {
          path: "/family/epidemicList",
          component: () => import('@/views/family/epidemicList.vue'),
          name: "epidemicList",
          meta: {
            title: "常驻人员防疫管理"
          },
        },
        {
          path: "/family/safeList",
          component: () => import('@/views/family/safeList.vue'),
          name: "safeList",
          meta: {
            title: "常驻人员安全管理"
          },
        },

      ],
    },
    
    {
      path: "/statistics",
      component: Layout,
      meta: {
        title: "数据统计",
      },
      children: [
        {
          path: "/statistics/statisticsList",
          component: () => import('@/views/statistics/statisticsList.vue'),
          name: "statisticsList",
          meta: {
            title: "数据统计"
          },
        }
      ],
    },
    {
      path: "/operation",
      component: Layout,
      meta: {
        title: "操作日志",
      },
      children: [
        {
          path: "/operation/operationList",
          component: () => import('@/views/operation/operationList.vue'),
          name: "operationList",
          meta: {
            title: "操作日志"
          },
        },
      ],
    },
    {
      path: "/extra",
      component: Layout,
      meta: {
        title: "来返人员数据统计",
      },
      children: [
        {
          path: "/extra/extraList",
          component: () => import('@/views/extra/extraList.vue'),
          name: "extraList",
          meta: {
            title: "来返人员数据统计"
          },
        },
        {
          path: "/extra/extraDetail",
          component: () => import('@/views/extra/extraDetail.vue'),
          name: "extraDetail",
          meta: {
            title: "详情",
            parentName: 'extraList',
            parentTitle: '来返人员数据统计'
          },
        }
      ],
    },
    {
      path: "/",
      redirect: '/workbench/workbench',
      component: Layout,
      meta: {
        title: "工作台",
      },
      children: [
        {
          path: "/workbench/workbench",
          component: () => import('@/views/workbench/workbench.vue'),
          name: "workbench",
          meta: {
            title: "工作台"
          },
        },
        {
          path: "/workbench/workbenchDetail",
          component: () => import('@/views/workbench/workbenchDetail.vue'),
          name: "workbenchDetail",
          meta: {
            title: "详情",
            parentName: 'workbench',
            parentTitle: '工作台'
          },
        }

      ],
    },
    {
      path: "/danger",
      component: Layout,
      meta: {
        title: "隐患管理",
      },
      children: [
        {
          path: "/danger/dangerList",
          component: () => import('@/views/danger/dangerList.vue'),
          name: "dangerList",
          meta: {
            title: "综合查询"
          },
        }, 
        {
          path: "/danger/dangerConduct",
          component: () => import('@/views/danger/dangerConduct.vue'),
          name: "dangerConduct",
          meta: {
            title: "工单办理"
          },
        },
        {
          path: "/danger/approvalList",
          component: () => import('@/views/danger/approvalList.vue'),
          name: "approvalList",
          meta: {
            title: "审核列表"
          },
        },
        {
          path: "/danger/analysisList",
          component: () => import('@/views/analysis/analysisList.vue'),
          name: "analysisList",
          meta: {
            title: "统计分析"
          },
        },
        {
          path: "/danger/dangerDetail",
          component: () => import('@/views/danger/dangerDetail.vue'),
          name: "dangerDetail",
          meta: {
            title: "详情",
            parentName: 'dangerList',
            parentTitle: '隐患列表'
          },
        },
      ],
    },
  ]
//创建
const router = createRouter({
  history: createWebHashHistory(),
  routes
})
export default router